<?php

namespace App\Services;

use App\Repository\Contracts\PermissionRepository;

class PermissionService
{
    /**
     * @var PermissionRepositoryEloquent
     */
    protected $permissionRepository;

    public function __construct(PermissionRepository $permissionRepository)
    {
        $this->permissionRepository = $permissionRepository;
    }

    public function allPermissions()
    {
        return $this->permissionRepository->all();
    }

    public function lists()
    {
        return $this->permissionRepository->paginate(10);
    }

    public function storePermisson($data)
    {

       return  $this->permissionRepository->toEntity()->create($data);

    }

    public function find($id)
    {

        return $this->permissionRepository->find($id);

    }

    public function updatePermission($id, $data)
    {
        return $this->permissionRepository->update($id, $data);
    }


    public function deletePermission($id)

    {

        return $this->permissionRepository->toEntity()->find($id)->delete();

    }

}